<% form_for(@recipe) do |f| %>
<div id="nav_div"><%= f.submit "Update" %> | <%= link_to 'Back To Recipe', :action => "show", :id => @recipe.id %> |<%= link_to 'Back To All Recipes', recipes_path %></div>
<% end %>
<% form_for(@recipe) do |f| %>
<div id="error_message"><%= error_messages_for :recipe %></div>
<table id="main_table">
  <tr>
  <td>
  <table id="three_column_table">
    <tr>
      <td id="center_column">
        <table id="new_recipe_table">
	<colgroup span='2'><col width='450'/><col width='450'/></colgroup>
	  <tr>
	    
	    <td id="new_left_column">
	      
	      <table id="new_right_table">
	        <tr>
		  <td colspan='2' style='font-weight: bold; font-size: 15pt'>
		    Edit Mode
		  </td>
		</tr>

		<tr>
	          <td><b>Title</b></td>
	          <td><%= f.text_field  :title, "size"=> 46 %></td>
	        </tr>

	        <tr>
	          <td><b>Description</b></td>
	          <td><%= f.text_field  :description, "size"=> 46 %></td>
	        </tr>

                <tr>
	          <td><b>Category</b></td>
	          <td><%= select ("recipe", "category_id", @categories.map {|u| [u.category,u.id]}) %>&nbsp;&nbsp;<%= link_to 'New category', new_category_path %></td>
	        </tr>

		<tr>
                  <td>
	            <b>Rating</b>
	          </td>
	          <td>
		      <% for i in (1..5) %>
		        <% if i == @recipe.rating %>
		        <%= radio_button("recipe", "rating", i, :class => "star", :checked => "checked") %>
		        <% else %>
		        <%= radio_button("recipe", "rating", i, :class => "star") %>
			<% end %>
		      <% end %>
	          </td>
	        </tr>

                <tr>
		  <td><b>Main Ingredient</b></td>
		  <td><%= f.text_field  :mainingredient, "size"=> 46 %></td>
		</tr>
                <tr>
		  <td></td>
		  <td>
		    &nbsp;&nbsp;&nbsp;<b>Ingredient</b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<b>Amount</b>
		  </td>
		</tr>
		<tr>
		  <td style='vertical-align:top' colspan='2'>
		    <div>
		      <input type='button' value='Add Ingredient' onclick="addFormField()" style='width: 100px'></input>
		      <input type="hidden" id="counter" value='2'></input>
		      &nbsp;&nbsp;&nbsp;<input size='19' type="text" id="ing1" name="ingredients[]"></input>&nbsp;
		      <input size='19' type="text" id="amt1" name="amounts[]"></input>
		    </div>
		  </td>
		</tr>
		<tr>
		  <td colspan='2'>
		    <div id='divTxt'>
		    </div>
		  </td>
		</tr>
	      </table>
	    </td>

	    <td id="new_right_column">

              <table>

		<tr>
		  <td style='vertical-align: top'>
		    <%= f.text_area :instructions, :cols=>"50" %>
		  </td>
		</tr>
              </table>
	    </td>

	  </tr>
	  <tr>
	    <td colspan='2' style='background-color: white; text-align: center'>
	       <p>
                 <a href="http://validator.w3.org/check?uri=referer"><img
                 src="http://www.w3.org/Icons/valid-xhtml10-blue"
                 alt="Valid XHTML 1.0 Transitional" height="31" width="88" /></a>
               </p>
	    </td>
	  </tr>
        </table>

      </td>
    
    </tr>
  </table>
  </td>
  </tr>
</table>
<% end %>
